//
//  HRBlackListViewModel.m
//  Hear
//
//  Created by mac on 2017/4/21.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "HRBlackListViewModel.h"
#import "HRBlackListModel.h"
@implementation HRBlackListViewModel
-(void)getBlackListContentModel:(HRBlackListRequestModel*)requstModel resultArr:(void(^)(NSArray *resultArr))resultArr{
    YTKApi *api = [YTKApi apiGetWithUrl:@"UserInfo/Get_GetUserBlacklistByUserLocalId" parameter:requstModel];
    [api getSuccessToken:^() {
        api.foceNoTocken = NO;
        [api setRequestSerializerType:YTKRequestSerializerTypeJSON];
        [api startWithCompletionBlockWithSuccess:^(__kindof YTKBaseRequest * _Nonnull request) {
            
            NSDictionary *dict = request.responseJSONObject;
            
            
            resultArr([NSArray modelArrayWithClass:[HRBlackListModel class] json:dict[@"BodyContent"]]);
            
        } failure:^(__kindof YTKBaseRequest * _Nonnull request) {
            resultArr(@[]);
        }];
    }];
}

-(void)deleteBlackListContentModel:(NSDictionary*)requstDict seccess:(void(^)(BOOL seccess))seccess{
    YTKApi *api = [YTKApi apiDeleteWithUrl:@"UserInfo/Delete_DeleteBlackList" para:requstDict];
    [api getSuccessToken:^() {
        api.foceNoTocken = NO;
        [api setRequestSerializerType:YTKRequestSerializerTypeJSON];
        [api startWithCompletionBlockWithSuccess:^(__kindof YTKBaseRequest * _Nonnull request) {
            
            NSDictionary *dict = request.responseJSONObject;
            
            seccess(YES);
            
        } failure:^(__kindof YTKBaseRequest * _Nonnull request) {
            seccess(NO);
        }];
    }];
}
@end
